home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / PRUS101 / FCHKOS.PAS < prev    next >
Pascal/Delphi Source File  |  1994-12-19  |  3KB  |  115 lines

  1.  unit FCHKOS;
  2.  
  3.  { FIDO unit to detect different OS
  4.  (*************************************************************************)
  5.  
  6.      RELEASE 1.00 - as first contained in the file PRUS101.LZH
  7.         by Matthias Tichy, 2:2440/210.14, GERMANY
  8.  
  9.            --------------------------------------------
  10.         organized for Fido's PASCAL related echoes
  11.            --------------------------------------------
  12.  
  13.      09/11/1994 to --/--/---- by Matthias Tichy, 2:2440/210.14, GERMANY
  14.  
  15.  
  16.        As far as third party copyrights are not violated this
  17.        source code is hereby placed to the public domain. Use
  18.        it whatever way you want, but use AT YOUR OWN RISK.
  19.  
  20.        In case you should modify the source rather send your
  21.        modifications to the unit's current organizer (see above for
  22.        NM address) than to spread it on your own. This will help to
  23.        keep the unit updated and grant a certain standard to all
  24.        other users as well.
  25.  
  26.        The unit is currently still under work. So it might greatly
  27.        benefit of your participation.
  28.  
  29.        Those who contributed to the following piece of source,
  30.        listed in alphabethical order:
  31.     ================================================================
  32.         Matthias Tichy, Joel Bergen, Andreas Otto ...
  33.     ================================================================
  34.        YOUR NAME WILL APPEAR HERE IF YOU CONTRIBUTE USEFUL SOURCE.
  35.  
  36.        Credits in your own programs are as welcome as unnecessary.
  37.  
  38. (***************************************************************************}
  39.  
  40. {$I FDEFINE.DEF} { Use the general include file for conditional defines and
  41.            common compiler directives ... }
  42.  
  43.          { ... and set the unit's specific defines aftwerwards. }
  44.  
  45. interface
  46.  
  47. type
  48.   TWindowsModes = (standard, enhanced);
  49.  
  50. var
  51.   NebenVersion : Byte;
  52.   HauptVersion : Byte;
  53.   Windows_Mode : TWindowsModes;
  54.  
  55. function isWindows : boolean;
  56. function isOS2 : boolean;
  57. function isDesqView : boolean;
  58.  
  59. implementation
  60.  
  61. uses dos;
  62.  
  63. var
  64.   R : Registers;
  65.  
  66. function isWindows : boolean;
  67.  
  68. begin
  69.   isWindows := false;
  70.   R.AX := $160A;
  71.   intr($2F, R);
  72.   if R.AX = 0 then
  73.     begin
  74.       HauptVersion := R.BH;
  75.       NebenVersion := R.BL;
  76.       case R.CX of
  77.         2 : Windows_Mode := standard;
  78.         3 : Windows_Mode := enhanced;
  79.       end;
  80.       isWindows := true;
  81.     end;
  82. end;
  83.  
  84. function isOS2 : boolean;
  85.  
  86. begin
  87.   isOS2 := false;
  88.   if lo(dosVersion) > 10 then
  89.     begin
  90.       isOS2 := true;
  91.       hauptVersion := lo(dosversion) div 10;
  92.       nebenVersion := hi(dosversion);
  93.     end;
  94. end;
  95.  
  96. function isDesqView : boolean;
  97.  
  98. { Source is from Joel Bergen | change by me }
  99.  
  100. BEGIN
  101.   R.CX := $4445;
  102.   R.DX := $5351;
  103.   R.AX := $2B01;
  104.   INTR($21,R);
  105.   isDesqView := (R.AL<>$0FF);
  106.   IF R.AL<>$0ff THEN
  107.     begin
  108.       NebenVersion := R.BL;
  109.       HauptVersion := R.BH;
  110.     end;
  111. END;
  112.  
  113. end.
  114.  
  115.